import Vue from "vue";
import Router from "vue-router";
const _import = require("./_import_" + process.env.NODE_ENV);
import Full from "@/containers/Full";

import login from "@/views/login/index";
import home from "@/views/home/home";
import user from "@/views/user/user";
import student from "@/views/student/student";
Vue.use(Router);

export const constantRouterMap = [
  { path: "/login", component: login, hidden: true }
];

export default new Router({
  mode: "hash",
  linkActiveClass: "open active",
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
});

export const asyncRouterMap = [
  {
    path: "/",
    redirect: "/home",
    name: "home",
    component: Full,
    hidden: false,
    children: [
      { path: "home", name: "home", component: home, icon: "thumbsup" },
      {
        path: "/admin",
        redirect:'/admin/user',
        name: "admin",
        component: { render(c) { return c("router-view"); }},
        icon: "thumbsup",
        hidden: false,
        children:[
          { path: "user", name: "user", icon: "thumbsup", component: user},
          { path: "student", name: "student", icon: "thumbsup", component: student}
        ]
      }
    ]
  },
  // {
  //   path: "/",
  //   redirect: "/home",
  //   name: "首页",
  //   component: Full,
  //   hidden: false,
  //   children: [
  //     { path: "/home", name: "Home", icon: "thumbsup", component: home },
  //     {
  //       path: "/admin",
  //       redirect: "/admin/demo",
  //       name: "管理员",
  //       icon: "thumbsup",
  //       component: {
  //         render(c) {
  //           return c("router-view");
  //         }
  //       },
  //       children: [
  //         { path: "demo", name: "demo", icon: "thumbsup", component: demo }
  //         // { path: '/user', name: '用户', icon: 'thumbsup', component: user },
  //         // { path: '/teacher', name: '教师', icon: 'thumbsup', component: teacher },
  //         // { path: '/student', name: '学生', icon: 'thumbsup', component: student }
  //       ]
  //     },
  //     { path: "/user", name: "用户", icon: "thumbsup", component: user },
  //     { path: "/teacher", name: "教师", icon: "thumbsup", component: teacher },
  //     { path: "/student", name: "学生", icon: "thumbsup", component: student }
  //   ]
  // },
  { path: "*", redirect: "/login", hidden: true }
];
